﻿namespace wwm.LeetCodeHelper;

/// <summary>
/// Provides a data source for a data theory, with the data coming from inline values.
/// </summary>
//[CLSCompliant(false)]
//[DataDiscoverer("Xunit.Sdk.InlineDataDiscoverer", "xunit.core")]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = true)]
public sealed class InlineDataAttribute : DataAttribute
{
    private readonly object[] _data;

    /// <summary>
    /// 内联测试数据特性
    /// </summary>
    /// <param name="ignoreOrder"></param>
    /// <param name="data"></param>
    public InlineDataAttribute(bool ignoreOrder, params object[] data)
    {
        this._data = data;
        this.IgnoreOrder = ignoreOrder;
    }
    /// <summary>
    /// Initializes a new instance of the <see cref="T:Xunit.InlineDataAttribute" /> class.
    /// </summary>
    /// <param name="data">The data values to pass to the theory.</param>
    public InlineDataAttribute(params object[] data)
    {
        this._data = data;
    }

    /// <inheritdoc />
    public override IEnumerable<object[]> GetData()
    {
        return new object[1][]
        {
            _data
        };
    }
}

